<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script>
    var arr1 = new Array(1,2,3,4,5);
    var arr2 = new Array(6,7,8,9,10);
    Array.prototype.sum = function () {

        var result = 0;
        for(var i=0;i<arr1.length;i++){
           result += this[i];
        }
        alert(result);
    }
    arr1.sum();
    arr2.sum();
</script>
</body>
</html>